var app = getApp(),
  a = app.requirejs('core');
Page({
    data: {
        qrcode: "",
        show:false
    },
    onLoad: function(e) {
      a.ReName(e.title);
      var that = this;
      var qrcode = app.getCache('qrcode');
      if (qrcode){
        that.setData({
          qrcode: qrcode,
          show:true
        })
      }else{
        a.get('Distribe/getShareCode', {
          uid:app.getCache('userinfo').uid
        }, function (t) {
          if (t.code == 0) {
            app.setCache('qrcode', t.info,300);
            that.setData({
              qrcode: t.info,
               show: true
            })
          } else {
            a.alert(t.msg, function () {
              a.jump('', 5);
            })
          }
        })
      }
      
    },
    onReady: function() {},
    onShow: function() {
  
    },
    click: function() {
        wx.previewImage({
            current: this.data.qrcode,
            urls: [ this.data.qrcode ]
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {}
});